import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { CommodityDetailComponent } from './commodity-management/commodity-detail/commodity-detail.component';
import { CommodityManagementComponent } from './commodity-management/commodity-management.component';
import { MainComponent } from './main.component';
import { PersonCenterComponent } from './person-center/person-center.component';

const routes: Routes = [
  {
    path: '',
    component: MainComponent,
    children: [
      {
        path: '',
        component: CommodityManagementComponent,
      },
      {
        path: 'detail/:id',
        component: CommodityDetailComponent,
      },
      {
        path: 'person',
        component: PersonCenterComponent,
      },
    ],
  },
];

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule],
})
export class MainRoutingModule {}
